use egui::Vec2;
use QcCore::ecs::components::{
    light::{AmbientBoxLight, DirectionalLight, Light},
    skybox::SkyBox,
};
use QcUI::core::context::UiContext;

use crate::inspector::{ComponentState, InspectorContext, InspectorTrait};

impl InspectorTrait for DirectionalLight {
    fn inspector(&mut self, ctx: &mut InspectorContext, state: &mut ComponentState) {
        egui::CollapsingHeader::new("DirectionalLight")
            .default_open(true)
            .show(ctx.ui, |ui| {
                ui.group(|ui| {
                    ui.set_min_width(ui.available_width() - 5.);
                    egui::Grid::new("DirectionalLight")
                        .num_columns(2)
                        .min_col_width(70.)
                        .spacing(Vec2::new(10., 10.))
                        .show(ui, |ui| {
                            ui.label("灯光颜色");

                            ui.color_edit_button_rgb(&mut self.light.color);

                            ui.end_row();
                            ui.label("灯光强度");
                            ui.add(egui::DragValue::new(&mut self.light.intensity).speed(0.01));

                            ui.end_row();
                        })
                });
            });
    }
}
